<template>
  <div>
    <!-- 加加减减 -->
    <ul>
      <li v-for="(item,index) in arr" :key="index">
        <span>{{item}}</span>
        <button @click="delFn(index)">删除</button>
      </li>
    </ul>
    <button @click="addFn">生成</button>
  </div>
</template>

<script>
export default {
  name: 'TimeAdd',

  data() {
    return {
      arr:[1,5,3]
    };
  },

  mounted() {
    
  },

  methods: {  
    addFn() {
      // 产生随机数放入数组值中
      this.arr.push(Math.floor(Math.random()*100))
    },
    delFn(index) {
      this.arr.splice(index,1)
    }
  },
};
</script>

<style lang="less" scoped>

</style>